<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module tws_c_codestyle_v0.3</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="tws_c_codestyle_v0.html"><font color="#ffffff">tws_c_codestyle_v0</font></a>.3</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:d%3A%5Ccode%5Ccoding_gaurd%5Cbd1_style_guide%5Ctws_c_codestyle_v0.3.py">d:\code\coding_gaurd\bd1_style_guide\tws_c_codestyle_v0.3.py</a></font></td></tr></table>
    <p><tt>Does&nbsp;tws&nbsp;codestyle&nbsp;check&nbsp;on&nbsp;c&nbsp;files.<br>
&nbsp;<br>
The&nbsp;goal&nbsp;of&nbsp;this&nbsp;script&nbsp;is&nbsp;to&nbsp;identify&nbsp;places&nbsp;in&nbsp;the&nbsp;code&nbsp;that&nbsp;"may"&nbsp;be&nbsp;in<br>
non-compliance&nbsp;with&nbsp;BD1&nbsp;coding&nbsp;style.&nbsp;It&nbsp;does&nbsp;not&nbsp;attempt&nbsp;to&nbsp;fix&nbsp;up&nbsp;these<br>
problems&nbsp;--&nbsp;the&nbsp;point&nbsp;is&nbsp;to&nbsp;educate.&nbsp;It&nbsp;does&nbsp;also&nbsp;not&nbsp;attempt&nbsp;to&nbsp;find&nbsp;all<br>
problems,&nbsp;or&nbsp;to&nbsp;ensure&nbsp;that&nbsp;everything&nbsp;it&nbsp;does&nbsp;find&nbsp;is&nbsp;legitimately&nbsp;a<br>
problem.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-GuardCheckForCopyright"><strong>GuardCheckForCopyright</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查文件是否有copyright.<br>
查找文件的第0~11行,&nbsp;检查其中是否有"Copyright"字符串<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[legal/copyright]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[File&nbsp;need&nbsp;Copyright:&nbsp;"Copyright&nbsp;[year]&nbsp;&lt;Copyright&nbsp;Owner&gt;"]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForFilenameFormat"><strong>GuardCheckForFilenameFormat</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查文件命名规范.<br>
1.&nbsp;名字全部使用英文小写字母a-z,&nbsp;中间可以有下划线'_'.<br>
2.&nbsp;除了文件类型后缀'.c''.h',&nbsp;文件名中不能有其他的'.'符号.<br>
3.&nbsp;不能使用'.'或'_开头',&nbsp;只能使用英文字母开头.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/filename]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Filename&nbsp;format&nbsp;error:&nbsp;"xxx_xxx.h"]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForHeaderFileHaveMarcoProtect"><strong>GuardCheckForHeaderFileHaveMarcoProtect</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查头文件的宏保护.<br>
1.&nbsp;使用与文件名同名的宏,&nbsp;如头文件aaa_bbb.h,&nbsp;应使用__AAA_BBB_H__来保护.<br>
2.&nbsp;前后需使用双下划线"__"<br>
example:<br>
&nbsp;&nbsp;filename:&nbsp;aaa_bbb.h<br>
&nbsp;&nbsp;#ifndef&nbsp;__XXX_XXX_H__&nbsp;//&nbsp;必须在第一行.<br>
&nbsp;&nbsp;#define&nbsp;__XXX_XXX_H__&nbsp;//&nbsp;必须在第二行.<br>
&nbsp;&nbsp;///code<br>
&nbsp;&nbsp;#endif&nbsp;//&nbsp;__XXX_XXX_H__&nbsp;//&nbsp;必须在倒数第一行.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/header_file]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Header&nbsp;file(xxx.h)&nbsp;need&nbsp;to&nbsp;be&nbsp;protected&nbsp;correctly.]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForIncludeFormat"><strong>GuardCheckForIncludeFormat</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查'#include'格式.<br>
1.&nbsp;'#include'顶行写,&nbsp;前面不能有空格.<br>
2.&nbsp;'#include'后只有一个空格,&nbsp;不能有多个空格<br>
3.&nbsp;需要使用双引号,&nbsp;不使用尖括号:&nbsp;正确:&nbsp;'#include&nbsp;"xxx.h"',&nbsp;&nbsp;错误:&nbsp;'#include&nbsp;&lt;xxx.h&gt;'<br>
4.&nbsp;不能带路径.错误:&nbsp;'#include&nbsp;"../aaa/bbb/xxx.h"'<br>
TODO:&nbsp;同一个客户的头文件放在一起.比如Green客户的头文件,&nbsp;都带'green_'前缀,&nbsp;需要放到一起.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/include]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;["#include"&nbsp;format&nbsp;error.]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForIncludeInHeaderFile"><strong>GuardCheckForIncludeInHeaderFile</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查头文件的文件引用.<br>
1.&nbsp;头文件中,&nbsp;不应该包含其他头文件(不能有'#include'符号).<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/header_file]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Header&nbsp;file(xxx.h)&nbsp;cannot&nbsp;include&nbsp;headerfiles.]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForLanguage"><strong>GuardCheckForLanguage</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查是否有中文字符<br>
1.&nbsp;文件中不能包含中文字符.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/language]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Cannot&nbsp;contain&nbsp;Chinese&nbsp;characters.]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForLineEndingWithBlank"><strong>GuardCheckForLineEndingWithBlank</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查行尾无用空白字符<br>
1.&nbsp;检查行尾是否有空白(空格、TAB、软换行等)<br>
TODO:&nbsp;2.&nbsp;将行尾的空白字符去掉drop,&nbsp;便于后续规范检查,&nbsp;减少重复报错.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/unused_space]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Please&nbsp;remove&nbsp;unused&nbsp;space&nbsp;or&nbsp;tab&nbsp;at&nbsp;end&nbsp;of&nbsp;the&nbsp;line]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForLineLength"><strong>GuardCheckForLineLength</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查每行字符长度<br>
1.&nbsp;包含前后空白字符.<br>
2.&nbsp;最大字符数量由"_MAX_LINE_LENS"定义.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/line_length]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Lines&nbsp;should&nbsp;be&nbsp;&lt;=&nbsp;%i&nbsp;characters&nbsp;long,&nbsp;but&nbsp;you&nbsp;have&nbsp;%i]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForMarcoFormat"><strong>GuardCheckForMarcoFormat</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查宏书写规范.<br>
1.&nbsp;每行顶格书写:&nbsp;'#if'&nbsp;前不能有空格.<br>
2.&nbsp;需要顶格书写的有:&nbsp;'#if',&nbsp;'#endif',&nbsp;'#endif',&nbsp;'#define'<br>
TODO:&nbsp;3.&nbsp;检查宏命名规范:&nbsp;全部只包含大写英文字母[A-Z]和下划线[_]<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/marco]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Marco&nbsp;format&nbsp;error:&nbsp;no&nbsp;indentation&nbsp;before&nbsp;"#"&nbsp;symbol."]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForMultiLineCommentAndReplaceByBlank"><strong>GuardCheckForMultiLineCommentAndReplaceByBlank</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查多行注释规范"/*&nbsp;*/":<br>
多行注释,&nbsp;分为&nbsp;'单行模式',&nbsp;'代码单行模式',&nbsp;'多行模式'.<br>
1.&nbsp;单行模式:&nbsp;整个注释位于新行,&nbsp;前后无代码.&nbsp;<br>
2.&nbsp;代码单行模式:&nbsp;注释位于代码行行尾或中间.&nbsp;<br>
3.&nbsp;多行模式:&nbsp;整个注释包含2行或以上.&nbsp;<br>
example:<br>
/**<br>
&nbsp;*&nbsp;comments<br>
&nbsp;*&nbsp;comments<br>
&nbsp;*<br>
&nbsp;*/<br>
&nbsp;<br>
1.&nbsp;单行模式规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;注释内容,&nbsp;与注释符号之间,&nbsp;应有且仅有一个空格:/*&nbsp;xxx&nbsp;*/<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Single-line&nbsp;mode)&nbsp;Format&nbsp;error&nbsp;syntax:&nbsp;"&nbsp;&nbsp;&nbsp;/*&nbsp;xxx&nbsp;*/".]<br>
&nbsp;&nbsp;b.&nbsp;注释不应为最后一行.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Single-line&nbsp;mode)&nbsp;Should&nbsp;not&nbsp;be&nbsp;the&nbsp;last&nbsp;line.']<br>
&nbsp;&nbsp;c.&nbsp;当下一行不为空时,&nbsp;缩进因与下一行一致.&nbsp;(当下一行有'}'符号时,&nbsp;缩进应比下一行多4个空格)<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Single-line&nbsp;mode)&nbsp;Indentation&nbsp;error,&nbsp;should&nbsp;be&nbsp;same&nbsp;with&nbsp;next&nbsp;line.]<br>
&nbsp;&nbsp;&nbsp;&nbsp;TODO:&nbsp;当下一行为空时,&nbsp;检查缩进应为顶行书写.&nbsp;<br>
2.&nbsp;单行代码模式规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;注释内容与注释符之间,&nbsp;有且只有一个空格:&nbsp;"/*&nbsp;comments&nbsp;*/"<br>
&nbsp;&nbsp;b.&nbsp;注释应位于行末,&nbsp;不应夹在代码之间:&nbsp;"code&nbsp;/*&nbsp;comments&nbsp;*/&nbsp;code;"<br>
&nbsp;&nbsp;c.&nbsp;注释内容与代码之间,&nbsp;有且只有一个空格:&nbsp;"code;&nbsp;/*&nbsp;comments&nbsp;*/"<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Code-line&nbsp;mode)&nbsp;Syntax&nbsp;error:&nbsp;"code&nbsp;/*&nbsp;comments&nbsp;*/"]<br>
3.&nbsp;多行模式规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;起始行应使用新行,&nbsp;前后不能有代码,&nbsp;起始行使用符号"/**".&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Start-line&nbsp;syntax&nbsp;error:&nbsp;"newline&nbsp;/**$".]<br>
&nbsp;&nbsp;b.&nbsp;起始行的缩进,&nbsp;应比下一行少一个空格:&nbsp;"&nbsp;*"&nbsp;比&nbsp;"/**"多一个空格.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Start-line&nbsp;indentation&nbsp;error.]<br>
&nbsp;&nbsp;c.&nbsp;中间行使用符号"&nbsp;*&nbsp;comments"&nbsp;或&nbsp;"&nbsp;*",&nbsp;注意'*'前的空格.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Mid-line&nbsp;syntax&nbsp;error:&nbsp;"&nbsp;*&nbsp;comments$".]<br>
&nbsp;&nbsp;d.&nbsp;中间行缩进,&nbsp;应和下一行一致.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Mid-line&nbsp;indentation&nbsp;error.]<br>
&nbsp;&nbsp;e.&nbsp;结束行应使用新行,&nbsp;前后不能有代码,&nbsp;使用符号"&nbsp;*/",&nbsp;&nbsp;注意空格.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Stop-line&nbsp;syntax&nbsp;error:&nbsp;"&nbsp;*/$'.]<br>
&nbsp;&nbsp;f.&nbsp;结束行,&nbsp;当下一行不为空时,&nbsp;缩进应比下一行多一个空格:&nbsp;"&nbsp;*/"前面有一个空格.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Stop-line&nbsp;indentation&nbsp;error.&nbsp;Next&nbsp;line&nbsp;is&nbsp;not&nbsp;None.]<br>
&nbsp;&nbsp;g.&nbsp;结束行,&nbsp;当下一行为空时,&nbsp;缩进应为1个空格:&nbsp;"&nbsp;*/"前面有一个空格.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Errors:<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/multi_line_comment]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[(Multi-line&nbsp;mode)&nbsp;Stop-line&nbsp;indentation&nbsp;error.&nbsp;Next&nbsp;line&nbsp;is&nbsp;None.]<br>
&nbsp;<br>
Note:&nbsp;在规范检查过程中,&nbsp;会将这些注释替换为空,&nbsp;不影响行数,&nbsp;也不修改原文件.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForNewlineAtEndOfFile"><strong>GuardCheckForNewlineAtEndOfFile</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查文件最后一行是否为空行.<br>
1.&nbsp;文件最后一行,&nbsp;应为空行.<br>
&nbsp;&nbsp;Errors:&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/ending_newline]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[Need&nbsp;new-line&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;file]<br>
2.&nbsp;文件倒数第二行，应有代码。<br>
&nbsp;&nbsp;Errors:&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;category:&nbsp;[whitespace/ending_newline]<br>
&nbsp;&nbsp;&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;[Only&nbsp;1&nbsp;blank&nbsp;line&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file.]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForSingleLineCommentAndReplaceByBlank"><strong>GuardCheckForSingleLineCommentAndReplaceByBlank</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查单行注释('//')规范<br>
单行注释,&nbsp;分为新行模式&nbsp;和&nbsp;代码行模式:&nbsp;<br>
1.&nbsp;新行模式:&nbsp;整个注释位于一个独立的新行,&nbsp;前面没有代码.<br>
2.&nbsp;代码行模式:&nbsp;注释位于代码最后.<br>
&nbsp;<br>
3.&nbsp;公共规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;"//"符号与注释间,&nbsp;应有且只有一个空格:&nbsp;"//&nbsp;comments"<br>
&nbsp;&nbsp;b.&nbsp;禁止注释内容为空的无效注释:&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;"//////&nbsp;&nbsp;"<br>
&nbsp;&nbsp;&nbsp;&nbsp;"//&nbsp;&nbsp;&nbsp;"<br>
&nbsp;&nbsp;c.&nbsp;不能同时有多于两个的斜杠:'///'<br>
4.&nbsp;新行模式规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;当"//"位于新行时,&nbsp;应位于代码上方一行,&nbsp;无空行:<br>
&nbsp;&nbsp;&nbsp;&nbsp;"//&nbsp;comments"<br>
&nbsp;&nbsp;&nbsp;&nbsp;"code;"<br>
&nbsp;&nbsp;b.&nbsp;当"//"位于新行时,&nbsp;缩进应保持与代码一致(在缩进中检查)<br>
&nbsp;&nbsp;&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;comments"<br>
&nbsp;&nbsp;&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;code;"<br>
5.&nbsp;代码行模式规则:&nbsp;<br>
&nbsp;&nbsp;a.&nbsp;当"//"位于代码行尾时,应与代码间至少有1个空格:&nbsp;"code;&nbsp;//&nbsp;comments"<br>
&nbsp;<br>
Note:&nbsp;在规范检查过程中,&nbsp;会将这些注释替换为空,&nbsp;不影响行数,&nbsp;也不修改原文件.<br>
&nbsp;<br>
Errors:&nbsp;单行模式:&nbsp;'//'和注释间,&nbsp;没有空格,&nbsp;或有多个空格.<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/sigle_line_comment]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[(Newline&nbsp;mode)&nbsp;Format&nbsp;error,&nbsp;syntax:&nbsp;"//&nbsp;xxx".]<br>
&nbsp;<br>
Errors:&nbsp;单行模式:&nbsp;注释不应该在文件的最后一行.<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/sigle_line_comment]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[(Newline&nbsp;mode)&nbsp;Should&nbsp;not&nbsp;be&nbsp;the&nbsp;last&nbsp;line.]<br>
&nbsp;<br>
Errors:&nbsp;单行模式:&nbsp;注释的下一行不应该为空.<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/sigle_line_comment]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[(Newline&nbsp;mode)&nbsp;Should&nbsp;not&nbsp;be&nbsp;blank&nbsp;in&nbsp;next&nbsp;line.]<br>
&nbsp;<br>
Errors:&nbsp;单行模式:&nbsp;注释的缩进,&nbsp;应和下一行相等.<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/sigle_line_comment]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[(Newline&nbsp;mode)&nbsp;Indentation&nbsp;error,&nbsp;should&nbsp;be&nbsp;same&nbsp;with&nbsp;next&nbsp;line.]<br>
&nbsp;<br>
Errors:&nbsp;多行模式:&nbsp;'//'前和后,&nbsp;有且只有一个空格.<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/sigle_line_comment]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[(Code-line&nbsp;mode)&nbsp;format&nbsp;error.&nbsp;syntax:&nbsp;"code&nbsp;//&nbsp;comments".]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForSrcFileUseExtern"><strong>GuardCheckForSrcFileUseExtern</strong></a>(filename, file_extention, lines)</dt><dd><tt>禁止在'.c'文件中使用'extern'.<br>
1.&nbsp;'.c'文件中,&nbsp;不能有extern开头的行.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/c_file]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Src&nbsp;file(xxx.c)&nbsp;forbid&nbsp;to&nbsp;use&nbsp;"extern".]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-GuardCheckForTabInLine"><strong>GuardCheckForTabInLine</strong></a>(filename, file_extention, lines)</dt><dd><tt>检查否有非法符号<br>
1.&nbsp;文件中不能包含'\t',&nbsp;'\f',&nbsp;'\r'等字符.<br>
&nbsp;<br>
Errors:&nbsp;<br>
&nbsp;&nbsp;category:&nbsp;[whitespace/tab]<br>
&nbsp;&nbsp;confidence:&nbsp;[5]<br>
&nbsp;&nbsp;message:&nbsp;[Please&nbsp;remove&nbsp;illegal&nbsp;symbols:&nbsp;"\t",&nbsp;"\f",&nbsp;"\r".]<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;需要处理的文件名.<br>
&nbsp;&nbsp;file_extention:&nbsp;filename的文件扩展类型,&nbsp;不含'.'符号,&nbsp;如'c',&nbsp;'h'等.<br>
&nbsp;&nbsp;lines:&nbsp;filename中的所有行列表[].</tt></dd></dl>
 <dl><dt><a name="-ProcessFile"><strong>ProcessFile</strong></a>(filename)</dt><dd><tt>Does&nbsp;coding&nbsp;style&nbsp;check&nbsp;on&nbsp;a&nbsp;single&nbsp;file.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;file&nbsp;to&nbsp;check.</tt></dd></dl>
 <dl><dt><a name="-main"><strong>main</strong></a>()</dt></dl>
</td></tr></table>
</body></html>